with Interfaces; use Interfaces;
with Element; use Element;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with IO;
package Block is


   type Lacing_Type is (NONE, XIPH, EBML, FIXED);

   type Frame_Type is
      record
         Size : Count := 0;
         File_Index : Positive_Count;
      end record;

   type Frame_Array is array (Unsigned_8 range <>) of Frame_Type;

   type Block_Header is
      record
         Track : Element_Size_Type;
         Timecode : Integer_16;
         Key_Frame : Boolean := False;
         Invisible : Boolean := False;
         Lacing : Lacing_Type := NONE;
         Discardable : Boolean := False;
      end record;
   procedure Read_Block_Header(Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out Block_Header);
   for Block_Header'Read use Read_Block_Header;
   Block_Header_Track_Exception : exception;

   type Block_Type is
      record
         Header : Block_Header;
         Reference_Block_Timecode : Integer := 0; -- do we need this?
         Size : Element_Size_Type := 0;
         File_Index : Positive_Count;
         Frames_Count: Unsigned_8 := 0;
         Frames : Frame_Array(1..10);
      end record;

   procedure Read_Block_Frames(File : IO.File_Type; Block : out Block_Type);


end Block;